package idiet.service;

import idiet.bean.FoodMaterialCategory;
import idiet.dao.hibernate.FoodMaterialCategoryDao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("foodMaterialCategoryService")
public class FoodMaterialCategoryService {
	@Autowired
	FoodMaterialCategoryDao FoodMaterialCategoryDao;
	public List<FoodMaterialCategory> getFoodMaterialCategoriesByMaterialName(String materialCategoryName){
		if(materialCategoryName!=null)
			return this.FoodMaterialCategoryDao.getFoodMaterialCategoriesByMaterialName(materialCategoryName);
		else
			return this.FoodMaterialCategoryDao.getFoodMaterialCategories();
	}
	public List<FoodMaterialCategory> getParentFoodMaterialCategories(){
		return this.FoodMaterialCategoryDao.getParentFoodMaterialCategories();
	}
	public List<FoodMaterialCategory> getChildFoodMaterialCategories(FoodMaterialCategory parentCategory){
		return this.FoodMaterialCategoryDao.getChildFoodMaterialCategories(parentCategory);
	}
	
}
